package com.yunsc.order.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-05-27 19:56
 */
@Data
public class OrderOverviewVO {
    // 订单总价格
    @JsonProperty("orderTotalPrice")
    private OverviewDetails orderTotalPrice;
    // 订单总数
    @JsonProperty("orderTotal")
    private OverviewDetails orderTotal;
    // 新用户总数
    @JsonProperty("newUserTotal")
    private OverviewDetails newUserTotal;
    // 付款用户总数
    @JsonProperty("consumeUserTotal")
    private OverviewDetails consumeUserTotal;

    // 构造方法
    public OrderOverviewVO(BigDecimal priceYeday, BigDecimal priceToday,
                         long payOrdersYeday, long payOrdersToday,
                         String userByYesterday, String userByToday,
                         long payUsersYeday, long payUsersToday) {
        this.orderTotalPrice = new OverviewDetails(String.valueOf(priceYeday), String.valueOf(priceToday));
        this.orderTotal = new OverviewDetails(String.valueOf(payOrdersYeday), String.valueOf(payOrdersToday));
        this.newUserTotal = new OverviewDetails(String.valueOf(userByYesterday), String.valueOf(userByToday));
        this.consumeUserTotal = new OverviewDetails(String.valueOf(payUsersYeday), String.valueOf(payUsersToday));
    }

    // 内部类用于存储yda和tda的数据
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class OverviewDetails {
        private String tday;
        private String ytd;
    }
}
